﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Net.Mime;
using System.Web.UI;
using Microsoft.ApplicationInsights.Extensibility.Implementation;
using Model;
using Model.Request;
using MongoDB.Bson;
using MongoDB.Bson.IO;
using static MongoDB.Bson.ObjectId;
using Newtonsoft.Json;
public partial class Questionnaire_TestDemo : Page
{
    public string ModifyKey="4B08BCEE-EE61-4842-9260-70D59C472FEA";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            

        }
    }

    /// <summary>
    /// 新生成一个套餐
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button3_Click(object sender, EventArgs e)
    {
        //var art = new GetAnswerRecordsRequest();
        //art.MemberId = txtMemberId1.Value;
        //art.SerialId = txtSerialId.Value;
        //art.Key = ScenerySecurityHelper.GetMD5(art.SerialId + art.MemberId, "utf-8", "tcwj");//加密
        //// Response.AppendCookie(cookie); ((art.MemberId + art.SerialId), ConvertHelper.ToString(art.MemberId));
        ////TextBox1.Text=art.ToJson();
        //menberId.Value = art.MemberId;
        //serialId1.Value = art.SerialId;
        //tocken.Value = art.Key;
        //div1.InnerHtml = string.Format("<script>jsonF('{0}','json_input')</script>", TCSmartFramework.Utility.Web.JsonHelper.JsonString(art));
        //Text1.Value = string.Format("?serialId={0}&memberId={1}&tocken={2}", art.SerialId, art.MemberId, art.Key);
    }

    /// <summary>
    /// 新生成一个套餐
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button2_Click(object sender, EventArgs e)
    {
        var qs = new QustionPaper
        {
            _id = ObjectId.Empty,
            Serid = "WJ201701140001",
            Title = "问卷标题"
        };
        qs.Title = "问卷标题";
        qs.AddNameId = "1";
        qs.AddName = "赵建";
        qs.AddTime = DateTime.Now.ToString();
        qs.Question = new List<Question>
        {
           new Question
            {
                  Id=qs.Serid+"_1",
                  Sort=1,
                  Title="这是一个单选问题",
                    QType = 1,
                  OptionList  = new List<Option>
                    {
                        new Option() { IsOthers=false,Id = 1,Sort = 1,Title = "这是选项A",Value = 1},
                         new Option() { IsOthers=false,Id = 1,Sort = 1,Title = "这是选项B",Value = 1},
                         new Option() { IsOthers=true,Id = 1,Sort = 1,Title = "这是选项C",Value = 1},
                    }



            },
            new Question
            {
                  Id=qs.Serid+"_1",
                  Sort=1,
                  Title="这是一个多选题",
                    QType = 1,
                  OptionList  = new List<Option>
                    {
                        new Option() { IsOthers=false,Id = 1,Sort = 1,Title = "这是选项A",Value = 1},
                         new Option() { IsOthers=false,Id = 1,Sort = 1,Title = "这是选项B",Value = 1},
                         new Option() { IsOthers=true,Id = 1,Sort = 1,Title = "这是选项C",Value = 1},
                    }



            },
        };

        var Request = new SetQuestionRequest();
        Request.Key = "111";
        Request.QuestionPaperInfo = qs;


        //string.Format("<script>jsonF('{0}','resposnTC')</script>", Newtonsoft.Json.JsonConvert.SerializeObject(qs));
    }
}